import 'package:flutter/cupertino.dart';
import 'package:honeypotflutter/modules/signFor/model/signForModel.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import 'package:honeypotflutter/publicBussine/bussine_font.dart';
import 'package:honeypotflutter/publicBussine/bussine_image.dart';

class SignForItem extends StatefulWidget {
  final SignForModel itemModel;
  const SignForItem({
    super.key,
    required this.itemModel,
  });

  @override
  State<SignForItem> createState() => _SignForItemState();
}

class _SignForItemState extends State<SignForItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: MGColors.whileColor,
      padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5),
      child: CupertinoListTile(
        leading: Image.asset(
          MGImage.image("express_default", type: ImagePathType.express),
          width: 35,
        ),
        title: Text(
          widget.itemModel.courierCompanyCodeDisplayName ?? "",
          style: TextStyle(
            fontSize: MGFont.textFont1,
            color: MGColors.text1Color,
          ),
        ),
        trailing: CupertinoSwitch(
          value: widget.itemModel.enableAutoSign ?? false,
          onChanged: (v) {
            setState(() {
              widget.itemModel.enableAutoSign = !(widget.itemModel.enableAutoSign ?? false);
            });
          },
        ),
      ),
    );
  }
}
